package mtons.cast.modules.controller;

import mtons.cast.modules.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by langhsu on 2017/10/16.
 */
@Controller
@RequestMapping("/msg")
public class MessageController {

    @Autowired
    private SimpMessagingTemplate template;

    @GetMapping("/test")
    @ResponseBody
    public Result test() {
        template.convertAndSend("/topic/notice", "test");
        return Result.success();
    }

}
